/**
 * Created by xiongxin on 17/7/28.
 */

(function(app, angular) {

    app.controller('myCompanyCtrl', ['$scope', 'myFactory', '$filter',  function($scope, myFactory, $filter) {
        
        
        initMyCompany();
        
        
        function initMyCompany() {
            myFactory.companyNew(function (result) {
                $scope.companyNewDatas = [];
                angular.forEach(result.data, function (data ,index, array) {
                    data.picUrl = testUrl + data.picUrl;
                    data.createDate = $filter('date')(data.createDate,'yyyy-MM-dd');
                    
                    if(data.content.length>12){
                        data.content = data.content.slice(0,12)+'...';
                    }
                    if(data.title.length>38){
                        data.title = data.title.slice(0,38)+'...';
                    }
                    $scope.companyNewDatas.push(data);
                })
            });
        }

        


    }]);
})(app, angular);